<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组</title>
</head>

<body>
    <script>
        let arr = [4, 3, 2, 5];
        document.write(`<div>length=${arr.length} </div>`);
        // // 升序
        // arr.sort(function (a, b) {
        //     return a - b;
        // });
        // 降序
        arr.sort(function (a, b) {
            return b - a;
        });
        document.write("arr=" + arr)
    </script>
</body>

</html>